﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.quest.Display.QuestManager {
    import flash.events.*;
    import Engine.Managers.*;
    import flash.display.*;
    import Display.*;
    import Display.hud.components.*;
    import Display.hud.*;

    public class QuestManagerSprite extends GameSprite {

        protected var m_questIcon:DisplayObject;
        protected var m_callBack:Function;
        protected var m_questToolTip:String;

        public function QuestManagerSprite(_arg1:String, _arg2:String, _arg3:DisplayObject, _arg4:Function){
            var _local5:Bitmap = (_arg3 as Bitmap);
            if (_local5 != null){
                this.m_questIcon = new Bitmap(_local5.bitmapData);
            } else {
                this.m_questIcon = _arg3;
            };
            this.m_questToolTip = _arg2;
            this.m_callBack = _arg4;
            this.name = _arg1;
            this.buttonMode = true;
            this.useHandCursor = true;
            this.hideCursor = true;
            this.addChild(this.m_questIcon);
            this.addEventListener(MouseEvent.CLICK, this.onQuestManagerIconClick, false, 0, true);
        }
        public function get questIcon():DisplayObject{
            return (this.m_questIcon);
        }
        public function get questCallBack():Function{
            return (this.m_callBack);
        }
        public function get questToolTip():String{
            return (this.m_questToolTip);
        }
        protected function onQuestManagerIconClick(_arg1:MouseEvent):void{
            var _local2:HUDQuestManagerComponent = (Global.hud.getComponent(HUD.COMP_QUESTS) as HUDQuestManagerComponent);
            if (!_local2){
                return;
            };
            if (!_local2.removeLastIconAndAddToQuestManager()){
                return;
            };
            UI.questManagerView.content.removeIcon(this, false);
            if (!_local2.addQuestManagerSprite(this)){
                this.addChild(this.m_questIcon);
                UI.questManagerView.content.addIcon(this);
            };
            StatsManager.count("quest_manager", "add_to_sidebar", this.name);
        }

    }
}//package Modules.quest.Display.QuestManager 
